package net.hn.hnms.biz.support.company.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import net.hn.hnms.biz.support.company.domain.dto.RiskStatisticsRockBurstDto;
import net.hn.hnms.biz.support.company.domain.vo.*;
import net.hn.hnms.biz.support.group.domain.vo.AbscissdataAlarmListVo;
import net.hn.hnms.biz.support.group.domain.vo.AnchordataAlarmListVo;
import net.hn.hnms.biz.support.group.domain.vo.SupportdataAlarmListVo;
import net.hn.hnms.biz.support.service.RockBurstService;
import net.hn.hnms.sys.common.core.domain.R;
import net.hn.hnms.sys.common.satoken.config.AutoSetMineCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;


/**
 * 华能集团-安全管理-冲击地压
 */
@Api(value = "华能集团-安全管理-冲击地压", tags = {"公司端-冲击地压"})
@RestController
@RequestMapping("company/rockBurst")
public class RockBurstController {

    @Autowired
    private RockBurstService rockBurstService;

    @ApiOperation("实时检测")
    @GetMapping("nowDetectionRockBurst")
    @AutoSetMineCode
    public R<NowDetectionRockBurstVo> nowDetection(@ApiParam(value = "煤矿编码") String mineCode, @ApiParam(value = "公司编码") String companyCode) {

        NowDetectionRockBurstVo nowDetectionRockBurstVo = rockBurstService.nowDetection(mineCode, companyCode);
        return R.ok(nowDetectionRockBurstVo);
    }

    @ApiIgnore
    @ApiOperation("联网情况")
    @GetMapping("networking")
    public R networking(@ApiParam(value = "煤矿编码") String mineCode,@ApiParam(value = "公司编码") String companyCode) {
        return R.ok();
    }


    @ApiOperation("今日报警处置情况")
    @GetMapping("todayAlarm")
    public R<List<TodayAlarmVo>> todayAlarm(@ApiParam(value = "煤矿编码") String mineCode, @ApiParam(value = "公司编码") String companyCode) {
        List<TodayAlarmVo> todayAlarmVos = rockBurstService.todayAlarm();
        return R.ok(todayAlarmVos);
    }
    @ApiOperation("冲击地压危险性评价等级")
    @GetMapping("riskAssessmentLevel")
    public R<RiskAssessmentLevel> riskAssessmentLevel(@ApiParam(value = "煤矿编码") String mineCode, @ApiParam(value = "公司编码") String companyCode) {
        RiskAssessmentLevel riskAssessmentLevel = new RiskAssessmentLevel();
        //强
        riskAssessmentLevel.setStrong("0");
        //中
        riskAssessmentLevel.setCentre("0");
        //弱
        riskAssessmentLevel.setWeak("0");

        return R.ok(riskAssessmentLevel);
    }

    @ApiOperation("冲击地压安全评分排名")
    @GetMapping("safetyScore")
    public R<List<ScoreRankingVo>> safetyScore(@ApiParam(value = "煤矿编码") String mineCode, @ApiParam(value = "公司编码") String companyCode) {
        List<ScoreRankingVo> scoreRankingVoList = new ArrayList<>();
        ScoreRankingVo scoreRankingVo = new ScoreRankingVo();
        scoreRankingVo.setScore(new BigDecimal("0"));
//        scoreRankingVo.setCompany("---");
        scoreRankingVo.setMine("---");
        scoreRankingVoList.add(scoreRankingVo);
        return R.ok(scoreRankingVoList);
    }

    @ApiOperation("风险统计")
    @GetMapping("riskStatistics")
    public R riskStatisticsRockBurst(RiskStatisticsRockBurstDto riskStatisticsRockBurstDto) {
        if (riskStatisticsRockBurstDto.getLib() == null || riskStatisticsRockBurstDto.getNumber() == null) {
            ChartVo chartVo = new ChartVo();
            chartVo.setXData(new ArrayList<>());
            chartVo.setValeus(new ArrayList<>());
            return R.ok(chartVo);
        }
        R r=rockBurstService.riskStatisticsRockBurst(riskStatisticsRockBurstDto);
        return r;
    }
    /**
     * 获取今日顶板离层报警列表
     */
    @ApiOperation("获取今日顶板离层报警列表")
    @GetMapping("getTodayAbscissdataAlarmList")
    public R<List<AbscissdataAlarmListVo>> getTodayAbscissdataAlarmList(@ApiParam(value = "公司编码") String companyCode) {
        List<AbscissdataAlarmListVo> list = rockBurstService.getTodayAbscissdataAlarmList(companyCode);
        return R.ok(list);
    }
    /**
     * 获取今日锚杆索报警列表
     */
    @ApiOperation("获取今日锚杆索报警列表")
    @GetMapping("getTodayAnchordataAlarmList")
    public R<List<AnchordataAlarmListVo>> getTodayAnchordataAlarmList(@ApiParam(value = "公司编码") String companyCode) {
        List<AnchordataAlarmListVo> list = rockBurstService.getTodayAnchordataAlarmList(companyCode);
        return R.ok(list);
    }
    /**
     * 获取今日支架报警列表
     */
    @ApiOperation("获取今日支架报警列表")
    @GetMapping("getTodaySupportdataAlarmList")
    public R<List<SupportdataAlarmListVo>> getTodaySupportdataAlarmList(@ApiParam(value = "公司编码") String companyCode) {
        List<SupportdataAlarmListVo> list = rockBurstService.getTodaySupportdataAlarmList(companyCode);
        return R.ok(list);
    }

}